/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package interfaz;

import Entidades.Estadia;
import gestoresHabitacion.GestorHabitacion;
import javax.swing.JOptionPane;
import javax.swing.JRootPane;

/**
 *
 * @author Franco
 */
public class OcuparHabitacion_SeguirCargando extends javax.swing.JFrame {

    /**
     * Creates new form CU_17_2
     */
    public OcuparHabitacion_SeguirCargando() {
        
        this.setVisible(true);
        this.setResizable(false);
        this.setTitle("continuar...");
        initComponents();
        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        boton_SeguirCargando = new javax.swing.JButton();
        boton_CargarOtraHab = new javax.swing.JButton();
        boton_Salir = new javax.swing.JButton();

        jLabel1.setText("jLabel1");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        boton_SeguirCargando.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        boton_SeguirCargando.setText("SEGUIR CARGANDO");
        boton_SeguirCargando.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_SeguirCargandoActionPerformed(evt);
            }
        });

        boton_CargarOtraHab.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        boton_CargarOtraHab.setText("CARGAR OTRA HABITACION");
        boton_CargarOtraHab.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_CargarOtraHabActionPerformed(evt);
            }
        });

        boton_Salir.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        boton_Salir.setText("SALIR");
        boton_Salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton_SalirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(boton_SeguirCargando)
                .addGap(18, 18, 18)
                .addComponent(boton_CargarOtraHab)
                .addGap(18, 18, 18)
                .addComponent(boton_Salir)
                .addContainerGap(37, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(44, 44, 44)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(boton_SeguirCargando)
                    .addComponent(boton_CargarOtraHab)
                    .addComponent(boton_Salir))
                .addContainerGap(28, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void boton_SeguirCargandoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton_SeguirCargandoActionPerformed
        this.dispose();
        OcuparHabitacion_SeleccionaPasajeros nuevaOcupacion= new OcuparHabitacion_SeleccionaPasajeros();
        nuevaOcupacion.setIdEstadia(idEstadia);
        nuevaOcupacion.setHayPasajeros(hayPasajeros);
        nuevaOcupacion.setTitle("Carga de Pasajeros en Habitacion");
    }//GEN-LAST:event_boton_SeguirCargandoActionPerformed

    private void boton_CargarOtraHabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton_CargarOtraHabActionPerformed
        if(!hayPasajeros){
                          JOptionPane.showMessageDialog(null, "Debe cargar al menos un pasajero","Advertencia",JOptionPane.WARNING_MESSAGE);

        
        }
        else{
            GestorHabitacion gestorHab=GestorHabitacion.getInstance();
            gestorHab.guardarEstadia(idEstadia);
                this.dispose();}
    }//GEN-LAST:event_boton_CargarOtraHabActionPerformed

    private void boton_SalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton_SalirActionPerformed
       if(!hayPasajeros){
                          JOptionPane.showMessageDialog(null, "Debe cargar al menos un pasajero","Advertencia",JOptionPane.WARNING_MESSAGE);

        
        }
        else{
           GestorHabitacion gestorHab=GestorHabitacion.getInstance();
            gestorHab.guardarEstadia(idEstadia);
                this.dispose();}
    }//GEN-LAST:event_boton_SalirActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(OcuparHabitacion_SeguirCargando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(OcuparHabitacion_SeguirCargando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(OcuparHabitacion_SeguirCargando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(OcuparHabitacion_SeguirCargando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new OcuparHabitacion_SeguirCargando().setVisible(true);
            }
        });
    }
    public void setCampos(Estadia idEstadia,boolean hayPasajeros ){
     this.hayPasajeros=hayPasajeros;
    this.idEstadia=idEstadia;}

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton boton_CargarOtraHab;
    private javax.swing.JButton boton_Salir;
    private javax.swing.JButton boton_SeguirCargando;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
private Estadia idEstadia;
private boolean hayPasajeros;
}
